/*
	File: E:/3D/games/mgt/svn_panzer_2010/data/scripts/water_plane_oscillate.nut
	Author: Francois Gutherz
*/

/*!
	@short	WaterPlaneOscillate
	@author	Francois Gutherz
*/
class	WaterPlaneOscillate
{
	
	t			=	0.0
	pos_init	=	0
	pos_rot		=	0
	pos_lag		=	0

	item_col	=	0


	/*!
		@short	OnUpdate
		Called during the scene update, each frame.
	*/
	function	OnUpdate(item)
	{
		t += g_dt_frame

		local	_y, _y_lag

		_y = Mtr(0.5) * sin(DegreeToRadian(35.0 * t))
		_y_lag = Mtr(0.5) * sin(DegreeToRadian(35.0 * t - 5.0))

		//pos_lag = pos_lag.Lerp(0.75, pos_init + Vector(0,_y_lag,0))
		ItemSetPosition(item, pos_init + Vector(0,_y,0))
		ItemSetPosition(item_col, pos_init + Vector(0,_y,0)) //pos_lag)
	}

	/*!
		@short	OnSetup
		Called when the item is about to be setup.
	*/
	function	OnSetup(item)
	{
		pos_init = ItemGetPosition(item)
		pos_lag = pos_init
		item_col = SceneFindItem(ItemGetScene(item), "water_plane_col")
	}
}
